var ClubTableMemberUnitItem = Item.extend({
    _ccsFileName: res.ClubTableMemberUnitItem_json,
    _data: null,
    onEnter: function () {
        Item.prototype.onEnter.call(this);
        TouchUtil.setOnclickListener(this._nodeList['btnJoin'], this._clickJoin.bind(this), {
            swallowTouches: false,
            isScroll: true
        });
    },

    refreshData: function (idx, data, isMember) {
        this._data = data;
        this._nodeList['background'].setVisible(idx % 2);
        if (isMember) {
            this._nodeList['lb_num'].setString(idx);
            this._nodeList['lb_name'].setString(ellipsisStr(data['name'], ClubDataManager.NirckNameSize));
            this._nodeList['lb_states'].setString(data['stateTips']);
            if (data['state'] == ClubDataManager.MemberState_Room) {
                this._nodeList['lb_states'].setTextColor(cc.color(222, 87, 82));
            } else {
                this._nodeList['lb_states'].setTextColor(cc.color(89, 136, 232));
            }
        } else {
            this._nodeList['wanfaName'].setString(data['name']);
            this._nodeList['wanfaBZ'].setString(data['remarks'] || '暂无备注');
        }
        this._nodeList['lb_num'].setVisible(isMember);
        this._nodeList['lb_name'].setVisible(isMember);
        this._nodeList['lb_states'].setVisible(isMember);
        this._nodeList['btnJoin'].setVisible(!isMember);
        this._nodeList['wanfaBZ'].setVisible(!isMember);
        this._nodeList['wanfaName'].setVisible(!isMember);
    },
    _clickJoin: function () {
        if (this._data['roomInfo'] && this._data['roomInfo']['room_id']) {
            clubMsgManager.requestJoinRoom(this._data['roomInfo']['room_id']);
        }
    },
});